#pragma once
#include "scbitf.h"
#include "iodev.h"
#include "safetydev.h"
#include "powerdev.h"

namespace rtdev {
class CabV2IoDev : public ScbIOItf
{
public:
    static const size_t kDOCnt = 16;
    static const size_t kDICnt = 16;
    static const size_t kAICnt = 2;
    static const size_t kAOCnt = 2;

public:
    CabV2IoDev();
    size_t dio_cnt(size_t& di_cnt, size_t& do_cnt)
    {
        di_cnt = kDICnt;
        do_cnt = kDOCnt;
        return kDOCnt + kDICnt;
    }
    size_t aio_cnt(size_t& ai_cnt, size_t& ao_cnt)
    {
        ai_cnt = kAICnt;
        ao_cnt = kAOCnt;
        return kAICnt + kAOCnt;
    }
    int set_do(std::vector<int8_t> output) final;
    int get_di(std::vector<int8_t> input) final;
    int get_ao(std::vector<double> output) final;
    int get_ai(std::vector<double> input) final;
    int get_encoder(uint8_t& dir, uint16_t& pulse) final;

    int config_aio_type(uint8_t id, uint8_t type);
    int config_dio_type(uint8_t id, bool is_output);

private:
    bool do_[kDOCnt];
    bool di_[kDICnt];
    uint8_t aio_type[kAICnt + kAOCnt];
    double ai_[kAICnt];
    double do_[kAOCnt];
};
class ScbCabV2 : public SafetyBoardItf
{
};
}  // namespace rtdev
